# -*- coding: utf-8 -*-   
import re  
import urllib  
  
  
def getHtml(url):  
    page = urllib.urlopen(url)  
    html = page.read()  
    return html  
  
  
def getImg(html):  
    reg = r'src="(.+?\.jpg)" pic_ext'  
    #p=re.compile('[^\._-][\w\.-]+@(?:[A-Za-z0-9]+\.)+[A-Za-z]+$|^0\d{2,3}\d{7,8}$|^1[358]\d{9}$|^147\d{8}')  
    regex = re.compile(r"\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b", re.IGNORECASE)  
      
      
    imgre = re.compile(regex)  
    imglist = re.findall(regex,html)  
    print imglist  
    return imglist     
    #x=0  
    #for imgurl in imglist:  
        #urllib.urlretrieve(imgurl,'%s.jpg' % x)   
        #x=x+1  
     
html = getHtml("https://tieba.baidu.com/p/1243877391")  
print getImg(html)  
